\c fivedash;
CREATE FUNCTION drop_db(TEXT) RETURNS TEXT AS '
BEGIN
                RETURN ''DROP DATABASE '' || quote_ident($1) || '';'';
END;
' LANGUAGE  plpgsql;

\t
\o /usr/local/fivedash/tmp.sql
select drop_db(db_name) from system.company;
\o
\t
\i /usr/local/fivedash/tmp.sql
\c postgres
drop database fivedash;
drop role fivedash;
